#include "Chest.h"

Chest::Chest(const Vector2df p, const Vector2df v) : StatefulUnit(p,v)
{
    loadSprite("Chest.sprite");
    setSpriteState("Chest");
};

Chest::~Chest()
{
    //dtor
}

void Chest::hit(const SimpleDirection dir, BaseUnit* player, CRstring parameter) {
    if (this->getSpriteState()=="Chest") {
        setSpriteState("Jumping"); // Need to figure out how to detect the end of an animation and change states, to allow a single jump
        m_statefulSprite->getSpriteForState(getSpriteState())->setLooping(false);
        m_statefulSprite->getSpriteForState(getSpriteState())->setCurrentFrame(0);
    } else {
        setSpriteState("Chest");
    }
    player->hit(dir.opposite(),this);
}
